<%--
  Created by IntelliJ IDEA.
  User: Think
  Date: 2024/7/22
  Time: 下午5:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<jsp:declaration>
    private int initVar = 0;
    private int serviceVar = 0;
    private int destoryVar= 0;
</jsp:declaration>

<jsp:declaration>
    public void jspInit(){
        initVar++;
        System.out.println("jsp init:Jsp被初始化了"+initVar+"次");
    }

    public void jspDestroy(){
        destoryVar++;
        System.out.println("jspDestory():Jsp被销毁了"+destoryVar+"次");
    }
</jsp:declaration>
<jsp:scriptlet>
    serviceVar++;
    System.out.println("jspService():Jsp共响应了"+serviceVar+"次请求");

    String content1 = "初始化次数："+initVar;
    String content2 = "响应请求次数"+serviceVar;
    String content3 = "销毁次数"+destoryVar;
</jsp:scriptlet>

<h1>jsp测试实例</h1>
<p><jsp:expression>content1</jsp:expression></p>
<p><jsp:expression>content2</jsp:expression></p>
<p><jsp:expression>content3</jsp:expression></p>
<p>session<jsp:expression>session.getId()</jsp:expression></p>
<p>request.cookies<jsp:expression>request.getCookies().toString()</jsp:expression></p>
<p>application.serviceinfo():<%= application.getServerInfo() %></p>
<%=request.getCookies().toString() %>
</body>
</html>
